//package com.gf.dynamicdemo.controller;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.gf.dynamicdemo.entity.DynamicConfig;
//import com.gf.dynamicdemo.service.DynamicConfigService;
//import com.gf.framework.mysql.controller.MysqlCrudController;
//import com.gf.framework.web.annotation.Translate;
//import com.gf.framework.web.annotation.Translator;
//import com.gf.framework.web.translate.TranslatorUtil;
//import io.swagger.annotations.Api;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cache.annotation.Cacheable;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @author gaofei
// * @date 2022/6/10 20:28
// */
//@RestController
//@Api(tags = "动态配置")
//public class DynamicConfigController extends MysqlCrudController<DynamicConfig, DynamicConfigService> {
//    @Autowired
//    RabbitTemplate rabbitTemplate;
//
//    @Autowired
//    TranslatorUtil translatorUtil;
//
//    @Override
//    protected Class<DynamicConfig> getEntityClass() {
//        return DynamicConfig.class;
//    }
//
//    @Override
//    public Long save(@RequestBody DynamicConfig data) {
//        return super.save(translatorUtil.translator(data));
//    }
//
//    @Override
//    public Boolean updateById(@RequestBody DynamicConfig data) {
//        return super.updateById(translatorUtil.translator(data));
//    }
//
//    @Cacheable(value = "DynamicConfig", key = "#id")
//    @Override
//    public DynamicConfig queryById(@PathVariable("id")Long id) {
//        DynamicConfig dynamicConfig = translatorUtil.translator(super.queryById(id));
//        rabbitTemplate.convertAndSend("test.exchange", "1234", dynamicConfig);
//        return dynamicConfig;
//    }
//
//    @Override
//    public Page<DynamicConfig> simplequery(
//            @RequestParam(value = "in", required = false, defaultValue = "")String ins,
//            @RequestParam(value = "eq", required = false, defaultValue = "")String eqs,
//            @RequestParam(value = "lt", required = false, defaultValue = "")String lts,
//            @RequestParam(value = "lte", required = false, defaultValue = "")String ltes,
//            @RequestParam(value = "gt", required = false, defaultValue = "")String gts,
//            @RequestParam(value = "gte", required = false, defaultValue = "")String gtes,
//            @RequestParam(value = "asc", required = false, defaultValue = "")String ascs,
//            @RequestParam(value = "desc", required = false, defaultValue = "")String descs,
//            @RequestParam(value = "currentpage")Integer currentPage,
//            @RequestParam(value = "pagecount")Integer pagecount
//    ) throws NoSuchFieldException {
//        Page<DynamicConfig> page = super.simplequery(ins, eqs, lts, ltes, gts, gtes, ascs, descs, currentPage, pagecount);
//        if (page.getRecords() != null) {
//            for (int i = 0; i < page.getRecords().size(); i++) {
//                page.getRecords().set(i, translatorUtil.translator(page.getRecords().get(i)));
//            }
//        }
//        return page;
//    }
//}
